package com.neudu.glsb.util;

import java.util.Random;

/**
 * 生成6位数字字母混合取餐码工具类
 */
public class PickupCodeUtil {
    // 包含数字0-9和大写字母A-Z（排除易混淆字符：0/O、1/I）
    private static final String BASE_CHARS = "23456789ABCDEFGHJKLMNPQRSTUVWXYZ";
    private static final int CODE_LENGTH = 6;
    private static final Random RANDOM = new Random();

    /**
     * 生成6位数字字母混合取餐码
     * @return 唯一取餐码（如：3A8K2P）
     */
    public static String generateMixedCode() {
        StringBuilder codeBuilder = new StringBuilder();
        for (int i = 0; i < CODE_LENGTH; i++) {
            // 随机获取字符索引
            int index = RANDOM.nextInt(BASE_CHARS.length());
            codeBuilder.append(BASE_CHARS.charAt(index));
        }
        return codeBuilder.toString();
    }
}